<template>
  <div class="vue3">
  </div>
</template>
<script setup>
import { onMounted } from 'vue';
const props = defineProps({
  keys: {
    type: Array,
    defalut: ''
  }
})
onMounted(()=>{
  keyUp()
})

const emit = defineEmits([
  'KeyW',
  'KeyS',
  'KeyQ',
  'KeyA',
  'KeyD',
  'Space',
  'KeyZ',
  'KeyC'
])
function keyUp() {
  document.addEventListener('keypress', (e) => {
    switch (e.code) {
      case 'KeyW':
        emit('KeyW')
        break;
      case 'KeyS':
        emit('KeyS')
        break;
      case 'KeyQ':
        emit('KeyQ')
        break;
      case 'KeyE':
        emit('KeyE')
        break;
      case 'KeyA':
        emit('KeyA')
        break;
      case 'KeyD':
        emit('KeyD')
        break;
      case 'Space':
        emit('Space')
        break;
      case 'KeyZ':
        emit('KeyZ')
        break;
      case 'KeyC':
        emit('KeyC')
        break;
    }
  })
}
</script>
<style scoped lang="scss"></style>
